#!/bin/bash

# 获取 /dev/shm 的挂载参数
options=$(mount | awk '$3=="/dev/shm"{gsub(/[()]/,"",$6); print $6}' | tr ',' '\n')

required_options=("noexec" "nosuid" "nodev")
missing_options=()

for opt in "${required_options[@]}"; do
    if ! echo "$options" | grep -qx "$opt"; then
        missing_options+=("$opt")
    fi
done

if [ ${#missing_options[@]} -eq 0 ]; then
    echo "[PASS] /dev/shm 已配置正确的挂载选项。"
else
    echo "[FAIL] /dev/shm 挂载选项未包含：${missing_options[*]}。"
fi